// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
@import '../../common/styles/root-level-only/color-definitions.scss';
@import '../../common/styles/root-level-only/global-styles.scss';
@import '../../common/styles/common.scss';

body {
    margin: 0;
    overflow-y: auto;
    height: fit-content; // required for the popup's window to resize properly when the details view is zoomed in/out
    background: $neutral-0;
    font-family: $font-family;
}

.telemetry-permission-dialog-modal {
    .ms-Overlay {
        background-color: $neutral-alpha-20;
    }
}

div.insights-dialog-main-override.telemetry-permission-dialog {
    border-radius: 6px;
    box-shadow: 0 0 10px 0 $neutral-alpha-60;
    width: 368px;

    // Workaround for issue https://github.com/microsoft/accessibility-insights-web/issues/4178
    //
    // The bug seems to affect only Chromium 91 (not 90 or 92); the workaround can be removed after
    // Edge/Chrome stable have been on 92 for a few weeks (ie, around September 2021).
    > .ms-Modal-scrollableContent {
        // This is normally 100vh, but #4178 causes "100vh" to be miscalculated as a very small
        // number. We can unset it in our case because the fixed popup window size means the dialog
        // height is fixed at a value that doesn't actually engage max-height anyway.
        max-height: unset;

        // Normally, office fabric uses padding of 0/24/24/24 and uses a media query to change it to
        // 0/16/16/16 at small window widths. #4178 means that the media query doesn't get triggered
        // like it's supposed to, but since the popup's window width is fixed, we can just force the
        // correct padding values without using the media query as a workaround.
        .ms-Dialog-inner {
            padding-top: 0;
            padding-right: 16px;
            padding-bottom: 16px;
            padding-left: 16px;
        }
    }

    .ms-Dialog-title {
        font-weight: $font-weight-semi-bold;
    }

    .ms-Checkbox-checkbox {
        border-radius: 4px;
    }

    .ms-Checkbox-checkmark {
        @media screen and (forced-colors: active) {
            color: canvastext !important;
        }
    }

    .telemetry-permission-details {
        font-size: 14px;
    }

    .start-using-product-button {
        border-radius: 2px;
    }

    .telemetry-checkbox-section {
        font-size: 12px;
        color: $primary-text;
        padding-top: 10px;
    }

    .telemetry-agree-checkbox {
        padding-bottom: 4px;
    }
}

html {
    height: fit-content; // required for the popup's window to resize properly when the details view is zoomed in/out
}

// The CSS selector here specifically targets Microsoft Edge.
// Certain heights/width values do not sit well with Microsoft Edge and need to be modified.
@supports (-ms-ime-align: auto) {
    body {
        height: unset;
    }

    html {
        height: unset;
    }

    #popup-container .unsupported-browser-info-panel {
        text-align: center;
        width: 30em;
        margin-top: 20px;
        margin-right: 14px;
        margin-bottom: 20px;
        margin-left: 14px;

        .incompatible-browser-message {
            margin-top: 15px;
        }

        [role='heading'] {
            width: unset;
            float: unset;
        }
    }
}

#popup-container,
#popup-container * {
    box-sizing: border-box;
}

#popup-container :is(h1, h2, h3, h4, h5, h6) {
    margin-block: 0;
    width: fit-content;
    padding-left: 0;
}

#popup-container .ad-hoc-tools-panel {
    width: 540px;
    margin-top: 10px;
    margin-bottom: 20px;
}

#popup-container .popup-grid {
    display: grid;
    margin-left: 8px;
    margin-right: 8px;
    font-size: 14px;
}

#popup-container .insights-spinner {
    margin: 4px;
}

#popup-container .unsupported-url-info-panel {
    width: 28em;
    margin-top: 20px;
    margin-right: 14px;
    margin-bottom: 20px;
    margin-left: 14px;
}

#popup-container .toggle-label {
    font-size: 16px;
}

#popup-container .ms-Link {
    @media screen and (forced-colors: active) {
        color: linktext !important;
    }

    color: $communication-primary;
    font-weight: 600;
}

#popup-container .main-section {
    margin-left: 14px;
    margin-right: 14px;

    .launch-pad-footer {
        color: $neutral-60;
        font-weight: 300;
        font-size: 11px;
        margin-bottom: 12px;
        margin-top: 12px;

        div + div {
            margin-top: 1vh;
        }

        a {
            font-weight: 600;
        }
    }

    .launch-pad-hr {
        margin-top: 12px;
        margin-bottom: 0;
        border-width: 1px 0 0 0;
        padding: 0;
        border-style: solid;
        border-color: $neutral-8;
    }

    .launch-pad-item-title {
        margin-top: 5px;
        margin-bottom: 5px;
        padding: 0;
        height: 20px;

        .ms-Link {
            font-weight: 600;
        }
    }
}

#popup-container .main-section label {
    padding: 0;
}

#popup-container .main-section .ms-Toggle-stateText {
    font-size: 11px;
    padding-top: 3px;
    color: $secondary-text;
}

.popup-menu .ms-ContextualMenu-icon {
    max-height: 30px;
}

#popup-container .main-section h3 {
    margin-top: 7px;
    margin-bottom: 7px;
}

#popup-container .main-section p {
    margin-top: 8px;
    margin-bottom: 8px;
}

#popup-container .main-section .footer {
    padding-top: 11px;
    padding-bottom: 10px;
}

#popup-container .main-section .ms-Toggle {
    padding-top: 2px;
    margin-bottom: 0;
}

#popup-container .main-section .ms-Spinner {
    padding-top: 3px;
}

#popup-container .main-section .ms-Checkbox-checkbox {
    margin: 0;
}

button[disabled]:not(.ms-ContextualMenu-link) {
    border: none;
}

button[disabled]:hover:not(.ms-ContextualMenu-link) {
    border: none;
}

button[disabled]:focus:not(.ms-ContextualMenu-link) {
    border: none;
}

#popup-container .right-float-button-row {
    float: right;
}

#popup-container .left-float-text-container {
    text-align: left;
}

#popup-container .centered-text-container {
    text-align: center;
}

#popup-container .right-float-text-container {
    text-align: right;
}

#popup-container .right-float-text-container-alias {
    text-align: right;
}

#popup-container .launch-panel-general-container {
    margin-bottom: 20px;
}

#popup-container .launch-pad-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: -4px;
}

#popup-container #new-launch-pad {
    width: 400px;
}

#popup-container .launch-panel {
    width: 296px;
    margin-top: 10px;
    margin-bottom: 10px;

    .launch-pad-main-section {
        width: 100%;
        margin: 0;

        .ms-Button-icon {
            width: 31px;
            height: 31px;
            font-size: 31px;
            line-height: 36px;
            color: $secondary-text;
            font-style: normal;
        }

        .popup-start-dialog-icon {
            width: 31px;
            height: 31px;
            font-size: 31px;
            line-height: 36px;
            color: $secondary-text;
            font-style: normal;
        }
    }

    .launch-pad-item-description {
        width: 280px;
    }

    .popup-start-dialog-icon-circle {
        border-radius: 50%;
        width: 59px;
        height: 59px;
        background-color: $communication-tint-30;
        margin-top: 12px;
        padding-top: 12px;
        padding-right: 14px;
        padding-bottom: 14px;
        padding-left: 14px;
    }

    .launch-pad-item-grid {
        display: grid;
        grid-template-columns: 1fr 2fr;
    }

    ::placeholder {
        font-style: italic;
    }
}

.gear-options-icon {
    padding-right: 5px;
}
